package com.example.yls.demoa;

import android.app.IntentService;
import android.content.Intent;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.Log;

public class MyIntentService extends IntentService {


    public MyIntentService() {
        super("MyIntentService");
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Log.e("MyIntentServiceOnCreate", "thread id= " + Thread.currentThread().getId());
    }

    @Override
    protected void onHandleIntent(@Nullable Intent intent) {
        Log.e("OnHandleIntent", "thread id= " + Thread.currentThread().getId());
        String url = intent.getStringExtra("URL");
        Log.e("OnHandleIntent", "url = " + url);


        /*    int i=0;
        while (i<60){
            Log.e("MyService","i= " + i );
            i++;
            try {
                Thread.sleep(1000);
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }*/
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.e("MyIntentService", "onDestroy");
    }
}
